package cate.common.table.d;

import cate.common.table.common.ParamSheet;
import lombok.Getter;

public class GDFriendAid {
    private static String ENDLESS_AID_REWARD;
    private static int ENDLESS_AID_TIMES;
    private static int ENDLESS_BORROW_TIMES;
    private static String ENDLESS_BORROW_REWARD;
    private static int ENDLESS_BORROW_REWARD_TIMES;
    private static double ENDLESS_AID_POWER_LIMIT;

    public enum FuncAid {
        /** 默认 */
        DEFAULT(0,  new FuncAidData(0,1, "0:4:100",1,"0:4:50", 3, 1.5)),
        /** 无尽试炼 */
        ENDLESS(GDFunc.ENDLESS,
                new FuncAidData(
                        GDFunc.ENDLESS,
                        ENDLESS_AID_TIMES,
                        ENDLESS_AID_REWARD,
                        ENDLESS_BORROW_TIMES,
                        ENDLESS_BORROW_REWARD,
                        ENDLESS_BORROW_REWARD_TIMES,
                        ENDLESS_AID_POWER_LIMIT
                        ));
        private int funcId;
        private FuncAidData aidData;
        FuncAid(int funcId, FuncAidData aidData) {
            this.funcId = funcId;
            this.aidData = aidData;
        }
    }

    public static FuncAidData getAidData(int funcId) {
        for (FuncAid funcAid : FuncAid.values()) {
            if (funcAid.funcId == funcId) {
                return funcAid.aidData;
            }
        }
        return FuncAid.DEFAULT.aidData;
    }

    @Getter
    public static class FuncAidData{
        private int funcId;
        private int aidTimes;
        private String aidReward;
        private int borrowTimes;
        private String borrowReward;
        private int borrowRewardTimes;
        private double aidPowerLimit;
        public FuncAidData(int funcId, int aidTimes, String aidReward, int borrowTimes, String borrowReward, int borrowRewardTimes, double aidPowerLimit) {
            this.funcId = funcId;
            this.aidReward = aidReward;
            this.borrowReward = borrowReward;
            this.borrowTimes = borrowTimes;
            this.aidTimes = aidTimes;
            this.borrowRewardTimes = borrowRewardTimes;
            this.aidPowerLimit = aidPowerLimit;
        }
    }

    /** 读取excel中配置的参数 */
    public static void initialize(ParamSheet paramSheet) {
        ENDLESS_AID_REWARD = GDParamTool.getString(paramSheet, 200201, "0:4:100");
        ENDLESS_AID_TIMES = GDParamTool.getInt(paramSheet, 200202, 1);
        ENDLESS_BORROW_TIMES = GDParamTool.getInt(paramSheet, 200203, 1);
        ENDLESS_BORROW_REWARD = GDParamTool.getString(paramSheet, 200204, "0:4:50");
        ENDLESS_BORROW_REWARD_TIMES = GDParamTool.getInt(paramSheet, 200205, 3);
        ENDLESS_AID_POWER_LIMIT = GDParamTool.getDouble(paramSheet, 200206, 1.5d);
    }
}
